package com.shrct.businessprocess.product.impl;

import com.shrct.businessprocess.product.RCIdentifiablePhysicalProductEntry;
import com.shrct.businessprocess.product.RCIdentifiablePhysicalProductEntryCriteria;
import com.shrct.businessprocess.product.RCNormalizerService;
import edu.fudan.mylang.pf.query.HQLBasedPagedQueryCriteria;
import org.hibernate.Query;
import org.springframework.beans.factory.BeanFactory;

public class RCIdentifiablePhysicalProductEntryCriteriaImpl extends HQLBasedPagedQueryCriteria<RCIdentifiablePhysicalProductEntry> implements RCIdentifiablePhysicalProductEntryCriteria {
  private String info;
  
  public String getInfo() {
    return this.info;
  }
  
  public RCIdentifiablePhysicalProductEntryCriteria setInfo(final String info) {
    this.info = info;
    return this;			
    
  }
  
  public void postInitialize() {
    BeanFactory _beanFactory = this.getBeanFactory();
    RCNormalizerService _bean = _beanFactory.<RCNormalizerService>getBean(RCNormalizerService.class);
    String _normalizeSid = _bean.normalizeSid(this.info);
    this.info = _normalizeSid;
  }
  
  protected String buildHQLFrom() {
    return " from com.shrct.businessprocess.product.impl.RCIdentifiablePhysicalProductEntryImpl this ";
  }
  
  protected String buildHQLBody() {
    String hql = "where 1 = 1 ";
    if( !edu.fudan.mylang.pf.query.QueryUtil.isNull(getInfo()) ){
    	hql += " and (this.normalizedSid  LIKE :info)" ;
    }
    return hql;
    
  }
  
  public void initOrderBys() {
    
  }
  
  protected void fillParameter(final Query query) {
    if( !edu.fudan.mylang.pf.query.QueryUtil.isNull(getInfo())){
    	query.setParameter("info",getInfo()) ;
    }			
    
  }
  
  protected Boolean isDistinct() {
    return false;
  }
  
  public RCIdentifiablePhysicalProductEntryCriteriaImpl() {
    initOrderBys();
  }
}
